package com.elitel.common.mongodb;

import com.mongodb.BasicDBObject;
import com.mongodb.client.MongoDatabase;

import org.bson.conversions.Bson;

import lombok.Data;

/**
 * TODO: Mongo 查询字段解析
 *
 * @since 2020-03-04
 */
@Data
public class QueryInfo {
  /** Mongo 数据库 */
  private MongoDatabase db;
  /** Mongo 集合名称 */
  private String collectionName;
  /** Mongo 展示字段 */
  private BasicDBObject fields;
  /** Mongo 查询条件 */
  private BasicDBObject where;

  // here is page NO for pageable
  private boolean isPageable;
  private int skipPageNo;
  private int pageSize;

  /** Mongo 排序 （-1是倒序，1是正序）默认正序 */
  private BasicDBObject orderBy;

  public BasicDBObject getOrderBy() {
    return orderBy;
  }

  public void setOrderBy(BasicDBObject orderBy) {
    this.orderBy = orderBy;
  }

  public MongoDatabase getDb() {
    return db;
  }

  public void setDb(MongoDatabase db) {
    this.db = db;
  }

  public String getCollectionName() {
    return collectionName;
  }

  public void setCollectionName(String collectionName) {
    this.collectionName = collectionName;
  }

  public BasicDBObject getFields() {
    return fields;
  }

  public void setFields(BasicDBObject fields) {
    this.fields = fields;
  }

  public BasicDBObject getWhere() {
    return where;
  }

  public void setWhere(BasicDBObject where) {
    this.where = where;
  }
}
